package com.push.common.utils;

import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.dictionary.py.Pinyin;

import java.util.ArrayList;
import java.util.List;

public class PinYinUtil {
    public static String getPinYin(String str){
        List<Pinyin> pinyinList = HanLP.convertToPinyinList(str);
        List<String> py = new ArrayList<>();
        for (Pinyin pinyin : pinyinList){
            py.add(pinyin.getPinyinWithoutTone());
        }
        return String.join(" ", py);
    };
}
